//============================================================================
// Name        : falling_path.cpp
// Author      : dfoelber
//============================================================================

// INCLUDES //
#include "physics/falling_path.h"
#include <iostream>
//////////////

using namespace std;

/**
* Constructor.
* 
* @param initialYVel Velocity of the falling speed
**/
FallingPath::FallingPath( double initialYVel ) : Path()
{
	yVel = initialYVel;
}

/**
* Lets the path know that time has passed and to move accordingly.
* 
* Overridden from Path.
* 
* @param ms The time passed since last called
**/
void FallingPath::TimePassed( int ms )
{
	yDistance = ((double)ms / 40.0) * yVel;
}

/**
* Input that can be used by the path.
* 
* Overridden from Path.
* 
* @param event The event
* @return If the event was consumed
**/
bool FallingPath::Input( SDL_Event event )
{
	// ignore input
    return false;
}

/**
* Check if this path collided with another path.
* 
* Overridden from Path.
* 
* @param other The other path.
**/
void FallingPath::CheckCollision( Path* other )
{
	/*if( (int)(side & SIDE_BOTTOM) == SIDE_BOTTOM )
	{
		if( yDistance > 0 )
		{
			yDistance = other->GetY() - GetHeight() - GetY();
		}
	}*/
}

/**
* Sets the position of the path.
* 
* Overridden from Path.
* 
* @param x The new X coordinate
* @param y The new Y coordinate
**/
void FallingPath::SetPosition( int x, int y )
{
	this->x = x;
	this->y = y;
}

/**
* Gets if the path is still moving.
* 
* Overridden from Path.
* 
* @return If the path is moving
**/
bool FallingPath::IsMoving()
{
	return true;
}
